package TOP101;

/**
 * @Question BM18
 * @Date 2022/11/7 11:26
 * @Solution
 */
public class BM18 {
    public boolean Find(int target, int[][] array) {
        for (int i = 0; i < array.length; i++) {
            int left = 0;
            int right = array[0].length - 1;
            while (left <= right) {
                int mid = (left + right) / 2;
                if (array[i][mid] > target) {
                    right = mid - 1;
                } else if (array[i][mid] < target) {
                    left = mid + 1;
                } else {
                    return true;
                }
            }
        }
        return false;
    }
}
